package w;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

class MyCellRenderer extends JLabel implements ListCellRenderer {

	public MyCellRenderer() {

		setOpaque(true);

	}

	public Component getListCellRendererComponent(

	JList list,

	Object value,

	int index,

	boolean isSelected,

	boolean cellHasFocus)

	{

		FolderNode node = (FolderNode) value;

		setIcon(node.getIcon());

		setText(value.toString());

		setBackground(isSelected ? Color.BLUE.darker().darker() : Color.WHITE);

		setForeground(isSelected ? Color.WHITE : Color.BLACK);

		return this;

	}

}
